#!/usr/bin/env bash
[[ -n $(docker ps -aqf ancestor=mysql:8.0) ]] && \
[[ -n $(docker rm -f mysql80) ]]
run_id=$(docker run \
       -d \
       --name mysql80 \
       --restart always \
       --net host \
       -v /data/docker/mysql80/data:/var/lib/mysql \
       -e MYSQL_ROOT_PASSWORD=tyjw2020! \
       -e TZ="Asia/Shanghai" \
       mysql:8.0 \
       --default-authentication-plugin=mysql_native_password \
       --character-set-server=utf8 \
       --collation-server=utf8_general_ci)
name=$(docker inspect -f "{{.Name}}" mysql80)
binds=$(docker inspect -f "{{.HostConfig.Binds}}" mysql80)
echo mysql-name: "${name:1}"
echo mysql-id: "${run_id:0:12}"
echo mysql-binds: "${binds}"
echo "----------------------docker mysql80 running successfully！-----------------------"
